From 11a03eba724c555fff11fdb7a8846a98f5838358 Mon Sep 17 00:00:00 2001
From: Yann Dirson <ydirson@o-computers.com>
Date: Thu, 14 Jan 2016 02:32:31 +0100
Subject: [PATCH 15/27] Fix paths to files in $(src) erroneously searched for
 in $(obj).

This fixes some part of building the kernel in a separate directory.
The remaining part (real libs really in source tree) is more tricky.
---
 arch/arm/mach-sunxi/power/brom/Makefile | 12 ++++++------
 drivers/arisc/binary/Makefile           |  4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-sunxi/power/brom/Makefile b/arch/arm/mach-sunxi/power/brom/Makefile
index b7b36d8..488cd6b 100755
--- a/arch/arm/mach-sunxi/power/brom/Makefile
+++ b/arch/arm/mach-sunxi/power/brom/Makefile
@@ -22,21 +22,21 @@ resumes-y :=   resumes.o        \
 
 resumes-y := $(addprefix $(obj)/,$(resumes-y))
 
-$(obj)/resumes.code: $(obj)/resumes.bin
-	$(Q)$(obj)/gen_check_code $(obj)/resumes.bin $(obj)/resumes.code
+$(obj)/resumes.code: $(src)/gen_check_code $(obj)/resumes.bin
+	$(Q)$< $(obj)/resumes.bin $(obj)/resumes.code
 
 $(obj)/resumes.bin: $(obj)/resumes.elf FORCE
 	$(Q)$(CROSS_COMPILE)objcopy -O binary $(obj)/resumes.elf $(obj)/resumes.bin
 
 ifneq ($(strip $(CONFIG_ARCH_SUN9I)),)
-$(obj)/resumes.elf: $(obj)/sun9i_brom_scatter.scat $(resumes-y)
-	$(Q)$(CROSS_COMPILE)ld -T $(obj)/sun9i_brom_scatter.scat  -EL  $(resumes-y) -o $(obj)/resumes.elf  -Map $(obj)/resumes.map
+$(obj)/resumes.elf: $(src)/sun9i_brom_scatter.scat $(resumes-y)
+	$(Q)$(CROSS_COMPILE)ld -T $<  -EL  $(resumes-y) -o $(obj)/resumes.elf  -Map $(obj)/resumes.map
 	$(Q)$(CROSS_COMPILE)objdump -D $(obj)/resumes.elf > $(obj)/resumes.lst
 endif
 
 ifneq ($(strip $(CONFIG_ARCH_SUN8I)),)
-$(obj)/resumes.elf: $(obj)/sun8i_brom_scatter.scat $(resumes-y)
-	$(Q)$(CROSS_COMPILE)ld -T $(obj)/sun8i_brom_scatter.scat  -EL  $(resumes-y) -o $(obj)/resumes.elf  -Map $(obj)/resumes.map
+$(obj)/resumes.elf: $(src)/sun8i_brom_scatter.scat $(resumes-y)
+	$(Q)$(CROSS_COMPILE)ld -T $<  -EL  $(resumes-y) -o $(obj)/resumes.elf  -Map $(obj)/resumes.map
 	$(Q)$(CROSS_COMPILE)objdump -D $(obj)/resumes.elf > $(obj)/resumes.lst
 endif
 
diff --git a/drivers/arisc/binary/Makefile b/drivers/arisc/binary/Makefile
index ab3d5d2..08b81fd5 100755
--- a/drivers/arisc/binary/Makefile
+++ b/drivers/arisc/binary/Makefile
@@ -29,8 +29,8 @@ ifdef CONFIG_ARCH_SUN9IW1P1
 PLATFORM=arisc_sun9iw1p1
 endif
 
-$(obj)/$(PLATFORM).bin : $(obj)/$(PLATFORM).code
-	cp $(obj)/$(PLATFORM).code $(obj)/$(PLATFORM).tar.bz2; \
+$(obj)/$(PLATFORM).bin : $(src)/$(PLATFORM).code
+	cp $< $(obj)/$(PLATFORM).tar.bz2; \
 	tar -xjvf $(obj)/$(PLATFORM).tar.bz2 -C $(obj)/; \
 	cp $(obj)/arisc_package/$(PLATFORM).bin $(obj)/$(PLATFORM).bin; \
 	cp $(obj)/arisc_package/$(PLATFORM).tar.bz2.aes $(obj)/arisc; \
-- 
1.9.1

